#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "CallAction.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class Behavior;
class Parameter;

/// <summary>
/// CallBehaviorAction
/// A CallBehaviorAction is a CallAction that invokes a Behavior directly. The
/// argument values of the CallBehaviorAction are passed on the input Parameters of
/// the invoked Behavior. If the call is synchronous, the execution of the
/// CallBehaviorAction waits until the execution of the invoked Behavior completes
/// and the values of output Parameters of the Behavior are placed on the result
/// OutputPins. If the call is asynchronous, the CallBehaviorAction completes
/// immediately and no results values can be provided.
/// </summary>
class UMLMODEL_EXPORT CallBehaviorAction : public CallAction {

public: // Constructors and destructors
    explicit CallBehaviorAction(const QString& umlType="uml::CallBehaviorAction");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Methods
    /// <summary>
    /// outputParameters
    /// Return the inout, out and return ownedParameters of the Behavior being called.
    /// </summary>
    shared_ptr<vector<Parameter>> outputParameters() const override;

    /// <summary>
    /// inputParameters
    /// Return the in and inout ownedParameters of the Behavior being called.
    /// </summary>
    shared_ptr<vector<Parameter>> inputParameters() const override;

public: // Properties
    /// <summary>
    /// behavior getter
    /// The Behavior being invoked.
    /// </summary>
    shared_ptr<Behavior> behavior() const;

    /// <summary>
    /// behavior setter
    /// The Behavior being invoked.
    /// </summary>
    void setBehavior(shared_ptr<Behavior> value);

private: // Fields
    /// <summary>
    /// behavior
    /// The Behavior being invoked.
    /// </summary>
    shared_ptr<Behavior> behavior_;

};

} // namespace uml
